import { defineStore } from 'pinia'
import { useCookies } from "@vueuse/integrations/useCookies"; // 引入cookie
const cookie = useCookies(); // cookie的调用

export const storeData = defineStore("dataStore",{
  // 数据 长久保存与localStorage
  persist: {
    key: 'gloable',
    storage: localStorage,
    paths: ['tabList','activeTab','userinfo','breadcrumb'],    //指定要长久化的字段
  },
  state: () =>{
    return{
      xiaohu:'xiaohu',
      userinfo: {username:'',avatar:'',}, // 用户的信息
      asideWidth: '250px',
      tabList: [
        {
          path: "/",
          title: "首页",
        },
      ],
      activeTab:'',
      breadcrumb: undefined,
    }
  },
  actions:{
    userinfoNull(){
      this.userinfo = {username:'',avatar:'',}
    },   
  },
  getters:{

  }

})


// export const useStore = defineStore('dataStore', {
//   persist: {
//     // 在这里进行自定义配置
//     storage: localStorage,
//     paths: ['tabList','activeTab','userinfo','breadcrumb'],    //指定要长久化的字段
//   },
//   state: () => ({
//     someState: '你好 pinia',
//   }),
  
// })


